package Server.Jsmj.RGCP.QILE;

public class HuResult {
	
	HuBlock huBlock;
	
	HuResult parentHuResult;
	
	
	public HuResult(){
		
	}
	
	@Override
	public boolean equals(Object obj) {
		if(obj == null){
			return false;
		}
		if(obj instanceof HuResult){
			HuResult objResult = (HuResult) obj;
			if(this.huBlock.equals(objResult) && this.parentHuResult.equals(objResult.parentHuResult)){
				return true;
			}
		}
		return false;
	}

	public HuCard toHuCard() {
		HuCard huCard = new HuCard();
		createHuCard(this, huCard);
		return huCard;
	}
	
	private void createHuCard(HuResult result, HuCard huCard){
		if(result.huBlock != null){
			huCard.addHuBlock(result.huBlock);
		}
		if(result.parentHuResult != null){
			createHuCard(result.parentHuResult, huCard);
		}
	}
}
